home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Updates, etc. / PG PRO⁄PG Lite Demos / PG PRO Demo / PG PRO Demo.rsrc / TEXT_3201_PG PRO.INCL.txt < prev    next >
Text File  |  1993-09-10  |  78KB  |  1,797 lines

  1. '===============================================================================
  2. '=                         Copyright 1992 Staz‚Ñ¢ Software, Inc.                 =
  3. '=              All rights reserved  / "PG PRO.INCL" from PG:PRO II            =
  4. '===============================================================================
  5. INCLUDE FILE _aplIncl
  6. COMPILE 0,_MacsbugLabels_strResource_caseInsensitive'set by PG:PRO
  7. GLOBALS "PG PRO.GLBL"'include standard global file
  8. END GLOBALS'no other globals
  9. DEFSTR LONG
  10. GOTO "PG:Start"
  11. '_______________________________________________________________________________
  12. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ ALERTS/DIALOGS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  13. '———————————————————————————————————————————————————————————————————————————————
  14. '_______________________________________________________________________________
  15. LOCAL FN pGcntrRes(type&,resID)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  16. '—————————————————————————————————————————————————————————————————————————————
  17. DIM t,l,b,r'local rect
  18. CURSOR _arrowCursor'reset arrow cursor
  19. hndl& = FN GETRESOURCE(type&,resID)'handle to alert resource
  20. LONG IF hndl&'got a handle?
  21. t;8 = [hndl&]'copy alert's rect
  22. CALL OFFSETRECT(t,-l,-t)'center it
  23. CALL OFFSETRECT(t,gScrnR/2-r/2,{_mBarHeight}+gScrnB/3-b/3)
  24. BLOCKMOVE @t,[hndl&],8'modify the resource
  25. END IF
  26. END FN
  27. '_______________________________________________________________________________
  28. LOCAL FN pGshowErr(errorNum)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  29. '—————————————————————————————————————————————————————————————————————————————
  30. DIM pTxt$(3)'holds message strings
  31. '## Description ---------- ## Description ---------- ## Description ----------
  32. '01 Add/Chg res failed     05 couldn't save pG3c res 09 used pGbuild(0)
  33. '02 couldn't get pG3w res  06 name of PG PRO app     10 used pGclose(0)
  34. '03 couldn't save pG3w res 07 paste too big for fld  11 your codes start here
  35. '04 couldn't get pG3c res  08 too many chars in fld  00 You CALL PARAMTEXT!
  36. '## Description ---------- ## Description ---------- ## Description ----------
  37. FN pGcntrRes(_"ALRT",_baseID-1)'center the error alert window
  38. LONG IF errorNum
  39. pTxt$(1) = STR#(_baseID-1,errorNum)'error message from STR#
  40. pTxt$(2) = MID$(STR$(errorNum),2)'error number from entry param
  41. pTxt$(3) = STR#(_baseID-1,6)'error message from STR#
  42. CALL PARAMTEXT(pTxt$(1),pTxt$(2),pTxt$(3),"")'set up text for alert
  43. END IF
  44. x = FN ALERT(_baseID-1,0)'show the alert
  45. END FN
  46. '_______________________________________________________________________________
  47. LOCAL FN pGgetText$(theDialog&,theItem)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  48. '—————————————————————————————————————————————————————————————————————————————
  49. DIM t;8'local DIMs
  50. CALL GETDITEM(theDialog&,theItem,itemType,itemHandle&,t)
  51. CALL GETITEXT(itemHandle&,theText$)'get the text
  52. END FN = theText$'return simple string
  53. '_______________________________________________________________________________
  54. LOCAL FN pGsetText(theDialog&,theItem,theText$)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  55. '—————————————————————————————————————————————————————————————————————————————
  56. DIM t;8'local DIMs/get this item
  57. CALL GETDITEM(theDialog&,theItem,itemType,itemHandle&,t)
  58. CALL SETITEXT(itemHandle&,theText$)'get the text
  59. CALL SELITEXT(theDialog&,theItem,0,[itemHandle&]+_TELength)
  60. END FN
  61. '_______________________________________________________________________________
  62. LOCAL FN pGframeBtn(theDialog&,theItem)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  63. '—————————————————————————————————————————————————————————————————————————————
  64. CALL SETPORT(theDialog&)'allow drwg before MODALDIALOG
  65. DIM t;8'local DIMs/get this item
  66. CALL GETDITEM(theDialog&,theItem,itemType,itemHandle&,t)
  67. CALL INSETRECT(t,-4,-4)'expand rect
  68. CALL PENNORMAL:PEN 3,3'3x3 pen
  69. LONG IF PEEK([itemHandle&]+_contrlHilite)=255'btn disabled
  70. CALL PENPAT(#REGISTER(A5)-28)'make it gray
  71. END IF'
  72. CALL FRAMEROUNDRECT(t,16,16)'frame it
  73. CALL PENNORMAL'restore pen
  74. END FN
  75. '_______________________________________________________________________________
  76. LOCAL FN pGask$(theQuestion$,theAnswer$)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  77. '—————————————————————————————————————————————————————————————————————————————
  78. theWindow = WINDOW(_activeWnd)'record current window
  79. CALL GETPORT(oldPort&)
  80. FN pGcntrRes(_"DLOG",_baseID - 2)'center the dialog
  81. CALL PARAMTEXT(theQuestion$,"","","")'show the prompt
  82. theDialog& = FN GETNEWDIALOG(_baseID - 2,0,-1)'get & disp the resource
  83. FN pGsetText(theDialog&,3,theAnswer$):theAnswer$=""'default answer
  84. FN pGframeBtn(theDialog&,1)'frame the OK btn
  85. DO'here we go
  86. CALL MODALDIALOG(0,hitItem)'cycle till OK/Cancel clicked
  87. UNTIL hitItem < 3'
  88. LONG IF hitItem = 1'was it OK?
  89. theAnswer$ = FN pGgetText$(theDialog&,3)'yes, return the answer
  90. IF theAnswer$="" THEN theAnswer$=" "'send a space if OK'd null
  91. END IF
  92. CALL DISPOSDIALOG(theDialog&)'all done
  93. LONG IF theWindow
  94. WINDOW(theWindow)'restore active window
  95. XELSE
  96. IF oldPort& THEN CALL SETPORT(oldPort&)
  97. END IF
  98. END FN = theAnswer$
  99. '_______________________________________________________________________________
  100. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ RESOURCE  FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  101. '———————————————————————————————————————————————————————————————————————————————
  102. '_______________________________________________________________________________
  103. LOCAL FN pGreplaceRes(resHndl&,resTp&,resID,resName$)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  104. '—————————————————————————————————————————————————————————————————————————————
  105. LONG IF resHndl&
  106. hndlFlags = FN HGETSTATE(resHndl&)'get state of new handle
  107. LONG IF hndlFlags AND _resource%'!! tried to send res hndl!!
  108. OSErr = FN HNOPURGE(resHndl&)'don't allow purge during copy
  109. newHndl& = FN HANDTOHAND(resHndl&)'duplicate the handle
  110. OSErr = FN HSETSTATE(resHndl&,hndlFlags)'restore orig state
  111. resHndl& = newHndl&'now use the new hndl
  112. END IF
  113. END IF
  114. LONG IF resHndl&
  115. curRes = FN CURRESFILE'record current res reference
  116. CALL USERESFILE(gResRef)'use output file
  117. oldRes& = FN GET1RESOURCE(resTp&,resID)'check for existing res
  118. LONG IF oldRes&'got one?
  119. hndlFlags = FN HGETSTATE(oldRes&)'save current handle info
  120. OSErr = FN HUNLOCK(oldRes&)'unlock it
  121. OSErr = FN HNOPURGE(oldRes&)'don't allow purge
  122. theSize& = FN GETHANDLESIZE(resHndl&)'get new size
  123. OSErr = FN SETHANDLESIZE(oldRes&,theSize&)'resize old to match
  124. BLOCKMOVE [resHndl&],[oldRes&],theSize&'replace old data
  125. OSErr = FN HSETSTATE(oldRes&,hndlFlags)'restore handle info
  126. oldRes& = FN STRIPADDRESS(oldRes&)'fix toolbox error
  127. CALL CHANGEDRESOURCE(oldRes&)'mark it as changed
  128. OSErr = FN DISPOSHANDLE(resHndl&)'dump the duplicate hndl
  129. LONG IF LEN(resName$)
  130. CALL SETRESINFO(oldRes&,resID,resName$)
  131. END IF
  132. XELSE'otherwise, just add it
  133. OSErr = FN HPURGE(resHndl&)'make it purgable now
  134. CALL ADDRESOURCE(resHndl&,resTp&,resID,resName$)'add it
  135. CALL SETRESATTRS(resHndl&,_resPurgeable%)'make it purgable
  136. resHndl& = FN STRIPADDRESS(resHndl&)'fix toolbox error
  137. CALL CHANGEDRESOURCE(resHndl&)'mark change(after SETRESATTRS)
  138. END IF'
  139. CALL USERESFILE(curRes)'restore orig file
  140. LONG IF FN RESERROR OR OSErr'any problems?
  141. FN pGshowErr(1)'my error code for failure
  142. END IF
  143. END IF
  144. END FN
  145. '_______________________________________________________________________________
  146. LOCAL FN pGreplaceXRes(resHndl&,resTp&,resID,resName$,resRef)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  147. '—————————————————————————————————————————————————————————————————————————————
  148. oldRes = gResRef'record old res file ref
  149. gResRef = resRef'temp switch to new
  150. FN pGreplaceRes(resHndl&,resTp&,resID,resName$)'save res in new file
  151. gResRef = oldRes'switch back to orig file
  152. END FN
  153. '_______________________________________________________________________________
  154. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ OBJECT  FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  155. '———————————————————————————————————————————————————————————————————————————————
  156. '_______________________________________________________________________________
  157. LOCAL FN pGcountObj(objListID)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  158. '—————————————————————————————————————————————————————————————————————————————
  159. resHndl& = FN GETRESOURCE(_"pG3c",objListID)'handle to wnd cntrl resource
  160. LONG IF resHndl&'valid handle?
  161. objCount = {[resHndl&]}'obj count is first word of res
  162. XELSE'no handle?
  163. FN pGshowErr(4)'tell user something's wrong
  164. objCount = 0'send back zero count
  165. END IF'
  166. END FN = objCount'FN result is num of elements
  167. '_______________________________________________________________________________
  168. LOCAL FN pGgetObj(objListID,objElem)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  169. '—————————————————————————————————————————————————————————————————————————————
  170. resHndl& = FN GETRESOURCE(_"pG3c",objListID)'handle to wnd cntrl resource
  171. LONG IF resHndl&'valid handle?
  172. DEC(objElem)'allow for OCNT
  173. offSet& = 2 + objElem * _objRecSz'calc offset to correct element
  174. gObject = [resHndl&]+offSet&'blkmove to global record
  175. XELSE'no handle?
  176. FN pGshowErr(4)'tell user something's wrong
  177. END IF'
  178. END FN
  179. '_______________________________________________________________________________
  180. LOCAL FN pGputObj(objListID,objElem)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  181. '—————————————————————————————————————————————————————————————————————————————
  182. resHndl& = FN GETRESOURCE(_"pG3c",objListID)'handle to wnd cntrl resource
  183. LONG IF resHndl&'valid handle?
  184. hState = FN HGETSTATE(resHndl&)
  185. OSErr  = FN HNOPURGE(resHndl&)
  186. DEC(objElem)'allow for OCNT
  187. offSet& = 2 + objElem * _objRecSz'calc offset to correct element
  188. BLOCKMOVE @gObjSel,[resHndl&]+offSet&,_objRecSz'blkmove to resource
  189. resHndl& = FN STRIPADDRESS(resHndl&)'fix toolbox error
  190. CALL CHANGEDRESOURCE(resHndl&)'mark it as changed
  191. OSErr = FN HSETSTATE(resHndl&,hState)
  192. XELSE'no handle?
  193. FN pGshowErr(5)'tell user something's wrong
  194. END IF
  195. END FN
  196. '_______________________________________________________________________________
  197. LOCAL FN pGgetRef(objListID,theRef)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  198. '—————————————————————————————————————————————————————————————————————————————
  199. theCount = FN pGcountObj(objListID)'number of objects
  200. element  = 0'element not yet found
  201. LONG IF theCount'non-zero count?
  202. FOR loop = 1 TO theCount'loop thru object list
  203. FN pGgetObj(objListID,loop)'get this object
  204. LONG IF gObjKind <> _graphicObj'ref not valid on graphics
  205. LONG IF ABS(gObjRef) = ABS(theRef)'matches reference?
  206. element = loop'record element
  207. loop    = theCount'shortcut the loop
  208. END IF'
  209. END IF
  210. NEXT
  211. END IF'
  212. END FN = element'global record filled on return
  213. '_______________________________________________________________________________
  214. LOCAL FN pGpointInObj'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  215. '—————————————————————————————————————————————————————————————————————————————
  216. DIM t;8
  217. theObject = 0
  218. objCount  = FN pGcountObj(gWhichClass)'get num of objs in list
  219. LONG IF objCount'non zero?
  220. resHndl&  = FN GETRESOURCE(_"pG3c",gWhichClass)
  221. FOR loop  = objCount-1 TO 0 STEP - 1'loop thru backwards
  222. offSet& = 2  + loop * _objRecSz
  223. t;8     = [resHndl&] + offSet& + 6
  224. LONG IF FN PTINRECT(gMouseY,t)'clicked here?
  225. theObject = loop + 1'set return value to this obj
  226. loop  = 0'jump the loop
  227. END IF
  228. NEXT
  229. END IF
  230. END FN = theObject
  231. '_______________________________________________________________________________
  232. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ DRAWING  FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  233. '———————————————————————————————————————————————————————————————————————————————
  234. '_______________________________________________________________________________
  235. LOCAL FN pGdepthOfPoint(my,mx)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  236. '—————————————————————————————————————————————————————————————————————————————
  237. inColor = _false
  238. LONG IF SYSTEM(_macPlus) = _false
  239. CALL LOCALTOGLOBAL(my)
  240. gdHndl& = FN GETDEVICELIST
  241. WHILE gdHndl&
  242. LONG IF FN PTINRECT(my,#[gdHndl&]+_gdRect)
  243. IF {[[[gdHndl&]+_gdpMap]]+_pmPixelSize} > 2 THEN inColor = _zTrue
  244. gdHndl& = 0
  245. END IF
  246. IF gdHndl& THEN gdHndl& = FN GETNEXTDEVICE(gdHndl&)
  247. WEND
  248. END IF
  249. END FN = inColor
  250. '_______________________________________________________________________________
  251. CLEAR LOCAL
  252. LOCAL FN pGblackAndWhite'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  253. '—————————————————————————————————————————————————————————————————————————————
  254. DIM RECORD aWndRec'auxiliary window rec
  255. DIM setCPat  ,aWndCPatID
  256. DIM setBWPat ,aWndBWPatID
  257. DIM setRGB   ,aWndRGBrec;6
  258. DIM aWndType&,aWndRefCon&
  259. DIM setFont  ,aWndFSize,aWndFMode,aWndFFace
  260. DIM setSpare ,aWndData;40,aWndDCODID
  261. DIM aWndRsrv1&,aWndRsrv2&
  262. DIM 60 aWndFontName$
  263. DIM END RECORD _aWndSz
  264.  
  265. CALL PENNORMAL'fix pen
  266. CALL FORECOLOR(33)
  267. CALL BACKCOLOR(30)
  268.  
  269. resHndl& = FN GETRESOURCE(_"pG3*",gWhichClass)
  270. LONG IF resHndl&
  271. BLOCKMOVE [resHndl&],@aWndRec,_aWndSz
  272. inColor = FN pGdepthOfPoint(WINDOW(3)/2,WINDOW(2)/2)
  273. LONG IF inColor'not black & white?
  274. LONG IF setCPat
  275. ppat& = FN GETPIXPAT(aWndCPatID)
  276. LONG IF ppat&
  277. CALL BACKPIXPAT(ppat&)
  278. END IF
  279. END IF
  280. LONG IF setRGB
  281. CALL RGBBACKCOLOR(aWndRGBrec)
  282. END IF
  283. XELSE'black & white
  284. LONG IF setBWPat
  285. pat& = FN GETPATTERN(aWndBWPatID)
  286. `       BEQ.S   noPat
  287. `       MOVE.L  D0,A0
  288. `       MOVE.L  (A0),-(SP)
  289. `       _backPat
  290. `noPat
  291. END IF
  292. END IF
  293. LONG IF setFont'default font
  294. LONG IF WINDOW(_outputWnd)
  295. CALL GETFNUM(aWndFontName$,fNum)
  296. TEXT fNum,aWndFSize,aWndFFace,aWndFMode-1
  297. END IF
  298. END IF
  299. END IF
  300.  
  301. END FN
  302. '_______________________________________________________________________________
  303. LOCAL FN pGuseObjColor'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  304. '—————————————————————————————————————————————————————————————————————————————
  305. LONG IF gScreenDepth > 1'not black & white?
  306. CALL RGBFORECOLOR(gObjFRed)'use object's forecolor
  307. CALL RGBBACKCOLOR(gObjBRed)'use object's backcolor
  308. END IF
  309. END FN
  310. '_______________________________________________________________________________
  311. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ CONTROL FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  312. '———————————————————————————————————————————————————————————————————————————————
  313. '_______________________________________________________________________________
  314. LOCAL FN pGfixEditor'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  315. '—————————————————————————————————————————————————————————————————————————————
  316. DIM t,l,b,r
  317. LONG IF WINDOW(_EFnum) = 8001'is this a Text Editor?
  318. FN pGgetRef(WINDOW(_outputWClass),8001)
  319. LONG IF gObjAutoReSz
  320. t;8 = WINDOW(_wndPointer)+_portRect'get window's rect
  321. r=r-15:b=b-17'inset for scroll bars
  322.  
  323. LONG IF BUTTON&(8000)
  324. wd = {[PRHANDLE] + _prInfo + _rPage + _right}
  325. SCROLL BUTTON 8000,,,wd,wd/5
  326. TEHndl& = TEHANDLE(8001)
  327. LONG IF TEHndl&
  328. BLOCKMOVE @t,[TEHndl&]+8,8
  329. oldR = r
  330. r = l + wd + 34
  331. CALL OFFSETRECT(t,-BUTTON(8000)+_TEWndInset,0)
  332. BLOCKMOVE @t,[TEHndl&],8
  333. r = oldR
  334. CALL TECALTEXT(TEHndl&)
  335. CALL TEUPDATE(t,TEHndl&)
  336. END IF
  337. XELSE
  338. CALL INSETRECT(t,_TEWndInset,_TEWndInset)
  339. EDIT FIELD 8001,,@t
  340. END IF
  341.  
  342. LONG IF BUTTON&(8001)'vert scroll present?
  343. rowCnt = ((b-t) >> 4) - 2'calc an avg row count
  344. SCROLL BUTTON 8001,,,,rowCnt'reset pg up/down
  345. END IF
  346.  
  347. END IF
  348. END IF
  349. END FN
  350. '_______________________________________________________________________________
  351. LOCAL FN pGdrawControls'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  352. '—————————————————————————————————————————————————————————————————————————————
  353. theCount = FN pGcountObj(gWhichClass)'count objects in window
  354. cBackPat = FN pGblackAndWhite
  355. firstFld = 0
  356. LONG IF theCount'non-zero?
  357. '
  358. FOR loop = 1 TO theCount'fields before scroll bars
  359. FN pGgetObj(gWhichClass,loop)'get next object
  360.  
  361. LONG IF gObjKind = _pictObj'it's a pict field
  362. LONG IF gObjResID'picture included?
  363. PICTURE FIELD gObjRef,%gObjResID,@gObjT,gObjZType,gObjZJust
  364. XELSE'no picture
  365. PICTURE FIELD gObjRef,"",@gObjT,gObjZType,gObjZJust
  366. END IF
  367. END IF'end of pict obj
  368.  
  369. LONG IF gObjKind = _styleObj'styled text field?
  370. gObjZJust = gObjZJust + (gObjFRed<<2)
  371. LONG IF gObjResID'existing text?
  372. resHndl& = FN GETRESOURCE(_"pG3t",gObjResID)
  373. LONG IF resHndl&
  374. EDIT FIELD -gObjRef,&resHndl&,(gObjL,gObjT)-(gObjR,gObjB),gObjZType,gObjZJust
  375. END IF
  376. XELSE'build it blank
  377. EDIT FIELD -gObjRef,"",@gObjT,gObjZType,gObjZJust
  378. END IF'NOTE: fields built 1st to allow
  379.  
  380. LONG IF firstFld = 0
  381. LONG IF ((gObjZType-1) AND &X1100)=0'not a static or gray field
  382. LONG IF gObjRef < 8000
  383. firstFld = gObjRef
  384. END IF
  385. END IF
  386. END IF'attachment to scroll bars
  387.  
  388. LONG IF firstFld = 0
  389. LONG IF ((gObjZType-1) AND &X1100)=0'not a static or gray field
  390. LONG IF gObjRef < 8000
  391. firstFld = gObjRef
  392. END IF
  393. END IF
  394. END IF
  395. END IF'end of _styleObj
  396.  
  397. NEXT
  398. '
  399. FOR loop = 1 TO theCount'scroll bars before lists
  400. FN pGgetObj(gWhichClass,loop)'get next object
  401. LONG IF gObjKind = _scrollObj'scroll bar?
  402. LONG IF ABS(gObjSel) <>1'part of a group?
  403. group = gObjSel'record current group
  404. attachedRef = 0
  405. FOR stylLoop = 1 TO theCount'loop thru obj list
  406. LONG IF stylLoop <> loop'not the same object
  407. FN pGgetObj(gWhichClass,stylLoop)'get obj record
  408. LONG IF group = gObjSel'part of same group?
  409. LONG IF gObjKind = _styleObj'styled field?
  410. attachedRef = -gObjRef'attach button to style field
  411. stylLoop = theCount'short cut rest of the loop
  412. END IF
  413. END IF
  414. END IF
  415. NEXT
  416. FN pGgetObj(gWhichClass,loop)'reload old record
  417. LONG IF attachedRef'was there a matching field?
  418. gObjRef = attachedRef'yes, change this reference
  419. END IF
  420. END IF
  421. SCROLL BUTTON gObjRef,gObjCtrlVal,gObjMin,gObjMax,gObjPgUpDn,@gObjT,gObjZType
  422. END IF'attachment to scroll bars
  423. NEXT
  424. '
  425. FOR loop = 1 TO theCount'loop thru list
  426. FN pGgetObj(gWhichClass,loop)'get next object
  427. SELECT gObjKind'what kind is it?
  428. CASE _styleObj,_pictObj'fields already built
  429. CASE _scrollObj'scroll bars already built
  430. CASE _buttonObj'it's a button
  431. LONG IF gObjZType
  432. objText$ = STR#(_baseID,gObjElement)
  433. BUTTON gObjRef,gObjCtrlVal,objText$,@gObjT,gObjZType
  434. XELSE
  435. gSubAction = _otherUserInit'set flag to init obj
  436. gWhichObjElem = loop
  437. oldWClass = gWhichClass
  438. GLOBALS GOSUB "PG:Any Other"
  439. gWhichClass = oldWClass
  440. FN pGblackAndWhite'user may have chgd bkgnd
  441. END IF
  442. CASE _listObj'it's a scrolling list
  443. resHndl& = FN GETRESOURCE(_"STR#",gObjResID)
  444. LONG IF resHndl&
  445. CALL GETRESINFO(resHndl&,ID,tp&,objText$)
  446. TEXT gObjLFont,gObjLSize,0,0
  447. SWAP gObjFBlue,gObjBlue
  448. IF gScreenDepth > 1 THEN CALL RGBFORECOLOR(gObjFRed)
  449. SWAP gObjFBlue,gObjBlue
  450. BUTTON gObjRef,gObjResID,objText$,@gObjT,gObjZType
  451. END IF
  452. END SELECT
  453. NEXT'next object
  454. END IF
  455. LONG IF firstFld'got an active field
  456. EDIT FIELD firstFld'activate it
  457. SETSELECT 0,WINDOW(_EFTextLen)'select all its text
  458. END IF
  459. END FN
  460. '_______________________________________________________________________________
  461. LOCAL FN pGsetGroup(theRef)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  462. '—————————————————————————————————————————————————————————————————————————————
  463. selectedBtn = 0'default result = none
  464. element = FN pGgetRef(gWhichClass,theRef)'get the referenced element
  465. LONG IF element'got it?
  466. LONG IF gObjKind = _buttonObj'is it a button?
  467. LONG IF ABS(gObjSel) > 1'part of a group?
  468. LONG IF gObjZType = 3'a radio button?
  469. theGroup = gObjSel'this is the group we need
  470. theCount = FN pGcountObj(gWhichClass)'number of objects
  471. FOR loop = 1 TO theCount'loop thru list
  472. FN pGgetObj(gWhichClass,loop)'get this obj
  473. LONG IF gObjSel = theGroup'right group?
  474. LONG IF gObjKind = _buttonObj'is it a button?
  475. LONG IF gObjZType = 3'a radio button?
  476. LONG IF gObjRef = theRef'set this one?
  477. BUTTON gObjRef,2
  478. XELSE
  479. LONG IF BUTTON(gObjRef) = 2'don't mess with disabled btns
  480. BUTTON gObjRef,1
  481. END IF
  482. END IF
  483. END IF
  484. END IF
  485. END IF
  486. NEXT loop
  487. END IF
  488. END IF
  489. END IF
  490. END IF
  491. END FN
  492. '_______________________________________________________________________________
  493. LOCAL FN pGgetGroup(theRef)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  494. '—————————————————————————————————————————————————————————————————————————————
  495. selectedBtn = 0'default result = none
  496. element = FN pGgetRef(gWhichClass,theRef)'get the referenced element
  497. LONG IF element'got it?
  498. LONG IF gObjKind = _buttonObj'is it a button?
  499. LONG IF ABS(gObjSel) > 1'part of a group?
  500. LONG IF gObjZType = 3'a radio button?
  501. theGroup = gObjSel'this is the group we need
  502. theCount = FN pGcountObj(gWhichClass)'number of objects
  503. FOR loop = 1 TO theCount'loop thru list
  504. FN pGgetObj(gWhichClass,loop)'get this obj
  505. LONG IF gObjSel = theGroup'right group?
  506. LONG IF gObjKind = _buttonObj'is it a button?
  507. LONG IF gObjZType = 3'a radio button?
  508. LONG IF BUTTON(gObjRef) = 2'is it set?
  509. selectedBtn = gObjRef'gotcha
  510. loop = theCount'skip the rest of the loop
  511. END IF
  512. END IF
  513. END IF
  514. END IF
  515. NEXT loop
  516. END IF
  517. END IF
  518. END IF
  519. END IF
  520. END FN = selectedBtn
  521. '_______________________________________________________________________________
  522. LOCAL FN pGbtnAction(theRef)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  523. '—————————————————————————————————————————————————————————————————————————————
  524. DIM t,l,b,r
  525. gDblClick = _false
  526. LONG IF theRef = 8000
  527. FN pGfixEditor
  528. XELSE
  529. element = FN pGgetRef(gWhichClass,theRef)'get btn's obj record
  530. LONG IF element'found the record?
  531. SELECT gObjKind
  532. CASE _scrollObj'a scroll button?
  533. t;8 = @gObjT'record it's rect
  534. theGroup = gObjSel
  535. LONG IF ABS(theGroup)>1
  536. theCount = FN pGcountObj(gWhichClass)'number of objects
  537. FOR loop = 1 TO theCount'loop thru list
  538. FN pGgetObj(gWhichClass,loop)'get this obj
  539. LONG IF gObjSel = theGroup
  540. LONG IF gObjKind = _listObj'scrolling list?
  541. LONG IF gObjT=t AND gObjR=l+1'next to this scroll bar?
  542. LONG IF BUTTON&(gObjRef)
  543. LONG IF {[[[BUTTON&(gObjRef)]+_contrlData]]} <> BUTTON(theRef)-1
  544. %[[[BUTTON&(gObjRef)]+_contrlData]],BUTTON(theRef)-1
  545. INC(gObjB):CALL CLIPRECT(gObjT)'add to clip & redraw
  546. CALL DRAW1CONTROL(BUTTON&(gObjRef))
  547. BUTTON gObjRef,BUTTON(gObjRef)'restores autoclip
  548. END IF
  549. END IF
  550. loop = theCount'shortcut the loop
  551. END IF
  552. END IF
  553. END IF
  554. NEXT
  555. END IF
  556. CASE _buttonObj'regular button?
  557. SELECT gObjZType'what type?
  558. CASE 2'check box?
  559. LONG IF BUTTON(gObjRef) = 2'if it was selected
  560. BUTTON gObjRef,1'deselect it
  561. XELSE'otherwise
  562. BUTTON gObjRef,2'select it
  563. END IF
  564. CASE 3'radio button?
  565. LONG IF ABS(gObjSel) <> 1'should be part of a group
  566. theGroup = gObjSel'record group number
  567. theCount = FN pGcountObj(gWhichClass)'number of objects
  568. FOR loop = 1 TO theCount'loop thru list
  569. FN pGgetObj(gWhichClass,loop)'get this obj
  570. LONG IF gObjSel = theGroup'same group?
  571. LONG IF BUTTON(gObjRef)'only toggle active buttons
  572. LONG IF gObjRef = theRef'clicked button?
  573. BUTTON gObjRef,2'yes, select it
  574. XELSE'no
  575. BUTTON gObjRef,1'deselect it
  576. END IF
  577. END IF
  578. END IF
  579. NEXT
  580. END IF
  581. END SELECT
  582. CASE _listObj
  583. LONG IF FN TICKCOUNT <= gDblTime&
  584. LONG IF gDblRef = theRef
  585. LONG IF gDblWnd = gActiveWnd
  586. gDblClick = _zTrue
  587. END IF
  588. END IF
  589. END IF
  590. LONG IF gDblClick = _false
  591. IF _ignoreSnglClk THEN gAction = 0
  592. gDblRef   = theRef
  593. gDblTime& = FN TICKCOUNT + [_doubleTime]
  594. gDblWnd   = gActiveWnd
  595. XELSE
  596. gDblWnd   = 0
  597. END IF
  598. END SELECT
  599. END IF
  600. END IF
  601. FN pGblackAndWhite
  602. END FN
  603. '_______________________________________________________________________________
  604. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ WINDOW FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  605. '———————————————————————————————————————————————————————————————————————————————
  606. '_______________________________________________________________________________
  607. LOCAL FN pGgetWnd$(resID,recordPtr&)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  608. '—————————————————————————————————————————————————————————————————————————————
  609. resHndl& = FN GETRESOURCE(_"pG3w",resID)
  610. LONG IF resHndl&
  611. BLOCKMOVE [resHndl&],recordPtr&,FN GETHANDLESIZE(resHndl&)
  612. CALL GETRESINFO(resHndl&,resID,tp&,wTitle$)
  613. XELSE
  614. FN pGshowErr(2)
  615. wTitle$ = "ERROR"
  616. END IF
  617. END FN = wTitle$
  618. '_______________________________________________________________________________
  619. LOCAL FN pGputWnd(resID,recordPtr&)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  620. '—————————————————————————————————————————————————————————————————————————————
  621. resHndl& = FN GETRESOURCE(_"pG3w",resID)
  622. LONG IF resHndl&
  623. OSErr = FN HNOPURGE(resHndl&)
  624. LONG IF FN GETHANDLESIZE(resHndl&) >0
  625. BLOCKMOVE recordPtr&,[resHndl&],FN GETHANDLESIZE(resHndl&)
  626. resHndl& = FN STRIPADDRESS(resHndl&)'fix toolbox error
  627. CALL CHANGEDRESOURCE(resHndl&)
  628. END IF
  629. OSErr = FN HPURGE(resHndl&)
  630. XELSE
  631. FN pGshowErr(3)
  632. END IF
  633. END FN
  634. '_______________________________________________________________________________
  635. LOCAL FN pGcalcWndGlobals'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  636. '—————————————————————————————————————————————————————————————————————————————
  637. gActWindow  = WINDOW(_activeWnd)
  638. gOutWindow  = WINDOW(_outputWnd)
  639. gWhichClass = WINDOW(_outputWClass)
  640. END FN
  641. '_______________________________________________________________________________
  642. LOCAL'∑∑œœœœœœœœœœœœœœœœœœœœœœœœœ∑∑
  643. DIM t;8
  644. LOCAL FN pGinsetWnd(t;8,theWndType,rectPtr&)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  645. '—————————————————————————————————————————————————————————————————————————————
  646. SELECT theWndType'what type of window is this?
  647. CASE 3,4 :CALL INSETRECT (t, 8, 8)'plain or shadow (8 pix border)
  648. CASE 2   :CALL INSETRECT (t,12,12)'modal dialog(8 pix gray+4 pix)
  649. CASE ELSE:CALL INSETRECT (t, 8, 8):t = t + 16'window with title bar
  650. END SELECT'done
  651. BLOCKMOVE @t,rectPtr&,8
  652. END FN'return with rect's addr
  653. '_______________________________________________________________________________
  654. LOCAL FN pGsetGrow'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  655. '—————————————————————————————————————————————————————————————————————————————
  656. DIM pGwT,pGwL,pGwB,pGwR,pGwKind,pGwAttrs,pGwMinX,pGwMinY
  657. DIM pGwMaxX,pGwMaxY,pGZmT,pGZmL,pGZmB,pGZmR
  658. DIM pGwHpg,pGwHMax,pGwVpg,pGwVMax,pGwRefCon&
  659.  
  660. wTitle$ = FN pGgetWnd$(gWhichClass,@pGwT)
  661. IF pGwMinX < 50 THEN pGwMinX = 50
  662. IF pGwMinY < 50 THEN pGwMinY = 50
  663. IF pGwMaxX < pGwMinX THEN pGwMaxX = 1000
  664. IF pGwMaxY < pGwMinY THEN pGwMaxY = 1000
  665.  
  666. MINWINDOW pGwMinX,pGwMinY
  667. MAXWINDOW pGwMaxX,pGwMaxY
  668. END FN
  669. '_______________________________________________________________________________
  670. LOCAL FN pGsetZoom'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  671. '—————————————————————————————————————————————————————————————————————————————
  672. DIM t,l,b,r,centerY,centerX
  673. DIM pGwT,pGwL,pGwB,pGwR,pGwKind,pGwAttrs,pGwMinX,pGwMinY
  674. DIM pGwMaxX,pGwMaxY,pGZmT,pGZmL,pGZmB,pGZmR
  675. DIM pGwHpg,pGwHMax,pGwVpg,pGwVMax,pGwRefCon&
  676.  
  677. wTitle$ = FN pGgetWnd$(gWhichClass,@pGwT)
  678.  
  679. LONG IF [@pGZmB]'custom zoom size
  680. t;8 = @pGZmT
  681. XELSE
  682. t;8 = @gScrnT'just copy the main scrn
  683. centerY = WINDOW(_height)>>1
  684. centerX = WINDOW(_width) >>1
  685. CALL LOCALTOGLOBAL(centerY)
  686. LONG IF SYSTEM(3) = 0'newer than a Mac plus
  687. gdHndl& =FN GETDEVICELIST'handle to 1st device in list
  688. DO
  689. t;8 = [gdHndl&]+_gdRect'get its rect
  690. LONG IF FN PTINRECT(centerY,t)'cntr of wnd in this monitor?
  691. gdHndl& = 0
  692. XELSE
  693. gdHndl& = FN GETNEXTDEVICE(gdHndl&)'get next scrn
  694. END IF'end of not main scrn
  695. UNTIL gdHndl& = 0
  696. END IF'end of not a max plus
  697. t = t + {_mBarHeight}'allow for the menu bar
  698. FN pGinsetWnd(@t,_docZoom,@t)'inset wnd as per window kind
  699. END IF
  700. SETZOOM gWhichWindow,@t
  701. END FN
  702. '_______________________________________________________________________________
  703. LOCAL FN pGupdate'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  704. '—————————————————————————————————————————————————————————————————————————————
  705. theCount = FN pGcountObj(WINDOW(_outputWClass))
  706. LONG IF theCount
  707. FOR loop = 1 TO theCount
  708. FN pGgetObj(WINDOW(_outputWClass),loop)
  709. LONG IF gObjKind = _graphicObj
  710. FN pGuseObjColor'set to this color
  711. LONG IF gObjZType'not a line
  712. LONG IF gObjFillPat > -1'shape is filled
  713. PEN 1,1,1,_patCopy,gObjFillPat'set fill pat
  714. SELECT gObjZType
  715. CASE 4:CALL PAINTRECT(gObjT)'filled box
  716. CASE 5:CALL PAINTROUNDRECT(gObjT,16,16)'filled rnd rect
  717. CASE 6:CALL PAINTOVAL(gObjT)'filled oval
  718. END SELECT
  719. END IF
  720.  
  721. PEN gObjRef,gObjRef,1,_patCopy,gObjLinePat
  722. SELECT gObjZType
  723. CASE 1,4:CALL FRAMERECT(gObjT)'box
  724. CASE 2,5:CALL FRAMEROUNDRECT(gObjT,16,16)'rnd rect
  725. CASE 3,6:CALL FRAMEOVAL(gObjT)'oval
  726. END SELECT
  727.  
  728. XELSE'it's a line
  729. PEN gObjRef,gObjRef,1,_patCopy,gObjLinePat
  730. CALL MOVETO(gObjL,gObjT)
  731. CALL LINETO(gObjR,gObjB)
  732. END IF
  733. XELSE
  734. LONG IF gObjKind = _buttonObj AND gObjZType = 0
  735. gSubAction    = _otherUserUpdate'set flag to draw obj
  736. gWhichObjElem = loop'record this element num
  737. FN pGcalcWndGlobals
  738. GLOBALS GOSUB "PG:Any Other"'  manually for GOSUB
  739. END IF
  740. END IF
  741. NEXT
  742. FN pGblackAndWhite
  743. END IF
  744. END FN
  745. '_______________________________________________________________________________
  746. LOCAL FN pGgetWTitle(theWindow)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  747. '—————————————————————————————————————————————————————————————————————————————
  748. gWindowTitle$ = ""
  749. LONG IF theWindow
  750. GET WINDOW theWindow ,wPtr&
  751. IF wPtr& THEN CALL GETWTITLE(wPtr&,gWindowTitle$)
  752. END IF
  753. END FN
  754. '_______________________________________________________________________________
  755. LOCAL FN pGcloseWindow(wndRefNum)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  756. '—————————————————————————————————————————————————————————————————————————————
  757. :'see if window exists
  758. LONG IF WINDOW(-wndRefNum) = 0 OR wndRefNum<1 OR wndRefNum>64
  759. FN pGshowErr(10)'show the error
  760. XELSE
  761. WINDOW wndRefNum
  762. gWhichClass = WINDOW(_outputWClass)
  763. gActWindow  = wndRefNum
  764. theCount = FN pGcountObj(gWhichClass)
  765. LONG IF theCount
  766. FOR loop = 1 TO theCount
  767. FN pGgetObj(gWhichClass,loop)
  768. LONG IF gObjKind = _buttonObj
  769. LONG IF gObjZType = 0
  770. gSubAction = _otherUserDispose'set flag to dispose obj
  771. gWhichObjElem = loop
  772. GLOBALS GOSUB "PG:Any Other"
  773. END IF
  774. END IF
  775. NEXT
  776. END IF
  777.  
  778. DIM pGwT,pGwL,pGwB,pGwR,pGwKind,pGwAttrs,pGwMinX,pGwMinY
  779. DIM pGwMaxX,pGwMaxY,pGZmT,pGZmL,pGZmB,pGZmR
  780. DIM pGwHpg,pGwHMax,pGwVpg,pGwVMax,pGwRefCon&
  781.  
  782. wTitle$ = FN pGgetWnd$(gWhichClass,@pGwT)
  783. LONG IF pGwAttrs AND _openPrevMask'‚Ǩ‚Ǩ Open Previous ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  784. pGwT;8 = WINDOW(_wndPointer)+_portRect'get local rect
  785. CALL LOCALTOGLOBAL(pGwT)'convert top/left to global
  786. CALL LOCALTOGLOBAL(pGwB)'convert bot/right to global
  787. FN pGputWnd(gWhichClass,@pGwT)'save these coords
  788. END IF'
  789. WINDOW CLOSE wndRefNum'close the window
  790. END IF
  791. FN pGcalcWndGlobals
  792. FN pGgetWTitle(gActWindow)
  793. END FN
  794. '_______________________________________________________________________________
  795. LOCAL FN pGclose(wndRefNum)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  796. '—————————————————————————————————————————————————————————————————————————————
  797. gDialogValue = wndRefNum
  798. GLOBALS GOSUB "PG:WCls"
  799. END FN
  800. '_______________________________________________________________________________
  801. LOCAL FN pGcloseAll'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  802. '—————————————————————————————————————————————————————————————————————————————
  803. OK2Close = _zTrue
  804. WHILE (WINDOW(_activeWnd)<>0) AND (gAction<>0)
  805. gDialogValue = WINDOW(_activeWnd)
  806. GLOBALS GOSUB"PG:WCls"
  807. OK2Close = (gAction <> 0)
  808. WEND
  809. END FN = OK2Close
  810. '_______________________________________________________________________________
  811. LOCAL FN pGbuild(wndRefNum)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  812. '—————————————————————————————————————————————————————————————————————————————
  813. DIM pGwT,pGwL,pGwB,pGwR,pGwKind,pGwAttrs,pGwMinX,pGwMinY
  814. DIM pGwMaxX,pGwMaxY,pGZmT,pGZmL,pGZmB,pGZmR
  815. DIM pGwHpg,pGwHMax,pGwVpg,pGwVMax,pGwRefCon&
  816. '
  817. DIM t,l,b,r'scratch rect
  818. DIM secndT,secndL,secndB,secndR'rect of secondary monitor
  819.  
  820. gWhichClass = ABS(wndRefNum)
  821.  
  822. LONG IF wndRefNum < 0
  823. FOR loop = 1 TO 64
  824. LONG IF WINDOW(-loop) = 0
  825. LONG IF FN GETRESOURCE(_"pG3w",loop) = 0
  826. wndRefNum = loop
  827. loop = 64
  828. END IF
  829. END IF
  830. NEXT
  831. END IF
  832.  
  833. LONG IF WINDOW(-wndRefNum)'already opened?
  834. WINDOW wndRefNum'bring it forward
  835. XELSE
  836. LONG IF FN GETRESOURCE(_"pG3w",gWhichClass) = 0
  837. FN pGshowErr(9):GOTO"PG:Build Complete"
  838. END IF
  839. wTitle$ = FN pGgetWnd$(gWhichClass,@pGwT)'get resource
  840. LONG IF wTitle$<>"ERROR"'got the resource?
  841. LONG IF pGwAttrs AND _openFullMask'‚Ǩ‚Ǩ Full/Main ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  842. pGwT;8 = @gScrnT'copy main screen rect
  843. FN pGinsetWnd(@pGwT,pGwKind,@pGwT)'adjust for title & borders
  844. END IF
  845. LONG IF pGwAttrs AND _openFull2Mask'‚Ǩ‚Ǩ Full/Secondary ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  846. LONG IF SYSTEM(3)'mac plus (no device drvr)
  847. pGwT;8 = @gScrnT'just copy the main scrn
  848. XELSE'otherwise
  849. gdHndl& =FN GETDEVICELIST'handle to 1st device in list
  850. pGwT;8 = [gdHndl&]+_gdRect'get its rect
  851. LONG IF {[gdHndl&]+_gdflags} AND _mainScreen%'keep going-it's main scrn
  852. gdHndl& = FN GETNEXTDEVICE(gdHndl&)'get second scrn
  853. LONG IF gdHndl&'2nd device exists?
  854. pGwT;8 = [gdHndl&]+_gdRect'copy it's rect
  855. XELSE'otherwise
  856. pGwT;8 = @gScrnT'copy main screen rect
  857. END IF'end of valid device hndl
  858. END IF'end of not main scrn
  859. END IF'end of not a max plus
  860. FN pGinsetWnd(@pGwT,pGwKind,@pGwT)'inset wnd as per window kind
  861. END IF'done
  862. LONG IF pGwAttrs AND _openBigMask'‚Ǩ‚Ǩ Full/Largest ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  863. LONG IF SYSTEM(3)'mac plus (no device drvr)
  864. pGwT;8 = @gScrnT'just copy the main scrn
  865. XELSE'otherwise
  866. pGwB = pGwT'any rect is larger than this
  867. gdHndl& = FN GETDEVICELIST'handle to 1st device in list
  868. DO'we'll run thru all devices
  869. LONG IF gdHndl&'good handle
  870. t;8 = [gdHndl&]+_gdRect'grab it's rect
  871. LONG IF ((b-t)*(r-l)) > ((pGwB-pGwT)*(pGwR-pGwL))
  872. pGwT;8 = @t'larger area - use this one
  873. END IF'
  874. END IF'
  875. gdHndl& = FN GETNEXTDEVICE(gdHndl&)'next graphic device in list
  876. UNTIL gdHndl& = 0'till there are no more
  877. END IF'dun
  878. FN pGinsetWnd(@pGwT,pGwKind,@pGwT)'allow for title/borders
  879. END IF'
  880. LONG IF pGwAttrs AND _openCntrMask'‚Ǩ‚Ǩ Center ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  881. CALL OFFSETRECT(pGwT,-pGwL,-pGwT)'Basic centers if zero offset
  882. END IF'
  883. LONG IF pGwAttrs AND _openPrevMask'‚Ǩ‚Ǩ Previous ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  884. LONG IF FN PTINRGN(pGwB,[_grayrgn])=_false'bot/right isn't visible?
  885. wd = gScrnR-gScrnL'width of main screen
  886. ht = gScrnB-gScrnT'height of main
  887. LONG IF pGwR - pGwL > wd'width won't fit?
  888. pGwR = gScrnR:pGwL = gScrnL'copy main screen rect
  889. t;8  = @pGwT'store old for restore of ht
  890. FN pGinsetWnd(@pGwT,pGwKind,@pGwT)'adjust for title & borders
  891. pGwT = t:pGwB = b'repair height to orig
  892. END IF'should be in position now
  893. LONG IF pGwB - pGwT > ht'height won't fit?
  894. pGwT = gScrnT:pGwB = gScrnB'copy main screen rect
  895. t;8  = @pGwT'store old for restore of wd
  896. FN pGinsetWnd(@pGwT,pGwKind,@pGwT)'adjust for title & borders
  897. pGwR = r:pGwL = l'repair width
  898. END IF'should be in position now
  899. IF pGwB > gScrnB THEN CALL OFFSETRECT(pGwT,0,gScrnB-pGwB)
  900. IF pGwR > gScrnR THEN CALL OFFSETRECT(pGwT,gScrnR-pGwR,0)
  901. END IF'end of bot/right invisible
  902. END IF
  903. LONG IF gWhichClass <> wndRefNum'‚Ǩ‚Ǩ Build Class ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  904. LONG IF pGwT OR pGwL'not centered
  905. chkWnd = 64'checking all windows
  906. WHILE chkWnd'until we hit zero
  907. GET WINDOW chkWnd,wPtr&'get this window
  908. LONG IF wPtr&'got a pointer?
  909. CALL SETPORT(wPtr&)'make it the current port
  910. `       MOVE.L  #0,^t               ;set point to 0,0
  911. CALL LOCALTOGLOBAL(t)'switch to global coords
  912. LONG IF pGwT = t OR pGwL = l'matches slot we want?
  913. CALL OFFSETRECT(pGwT,4,4)'offset to next position
  914. chkWnd = 64'restart at top of wnd list
  915. END IF'end of matched point
  916. END IF'end of valid wnd ptr
  917. DEC(chkWnd)'next (lower) window
  918. WEND'until checked wnd = 0
  919. END IF
  920. END IF'‚Ǩ‚Ǩ Invisible ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  921. LONG IF (pGwAttrs AND _openInvisMask) OR (pGwAttrs AND _openBehindMask)
  922. wndRefNum = -wndRefNum'open behind others
  923. END IF
  924. LONG IF SYSTEM(8) < 700'pre System 7.0
  925. IF pGwKind =  6 THEN pGwKind =  2'don't allow window type 6
  926. IF pGwKind = -6 THEN pGwKind = -2'not even modals
  927. END IF
  928. WINDOW wndRefNum,wTitle$,@pGwT,pGwKind,gWhichClass
  929. CALL SETRECT(t,-9999,-9999,9999,9999)
  930. CALL CLIPRECT(t)'‚Ǩ‚Ǩ 03/30/93 ‚Ǩ‚Ǩ
  931. FN pGblackAndWhite:CALL ERASERECT(t)
  932. LONG IF pGwHMax'window scroll bars
  933. SCROLL BUTTON 8000,1,1,pGwHMax,pGwHpg,,2'horiz scroll bar
  934. END IF
  935. ref = 0
  936. LONG IF pGwVMax
  937. LONG IF pGwAttrs AND 128
  938. FN pGdrawControls'draw the field in advance
  939. SCROLL BUTTON -8001,0,0,0,0,,1'vert scroll bar
  940. ref = -8001'use negative to hook in scroll
  941. CALL VALIDRECT(t)
  942. FN pGfixEditor
  943. XELSE
  944. ref = 8001'otherwise-standard V scroll
  945. SCROLL BUTTON ref,1,1,pGwVMax,pGwVpg,,1'vert scroll bar
  946. END IF
  947. END IF
  948. IF ref <> -8001 THEN FN pGdrawControls'ctrls for pg Wnds
  949. LONG IF pGwAttrs AND _openInvisMask'was in back
  950. LONG IF pGwRefCon& <> _"NVIS"'user didn't specify invisible
  951. WINDOW -wndRefNum'bring to front
  952. END IF
  953. END IF'
  954. LONG IF pGwAttrs AND _openBehindMask'was in back
  955. LONG IF pGwRefCon& <> _"NVIS"'user didn't specify invisible
  956. WINDOW OUTPUT wndRefNum'activate w/o bringing fwd
  957. END IF
  958. END IF
  959. LONG IF pGwAttrs AND 128'splash bit set
  960. LONG IF pGwVMax = 0'not a Text Editor
  961. FN pGupdate'don't wait for update event
  962. ticks& = FN TICKCOUNT + 140:flag =_false'calc time out:clear flag
  963. DO'loop till button,key or ticks
  964. IF FN BUTTON OR LEN(INKEY$) THEN flag = _zTrue
  965. LONG IF FN TICKCOUNT>ticks&'sufficient number of ticks?
  966. LONG IF gWhichClass = wndRefNum'window num was not negative?
  967. flag = _zTrue'time expired - exit
  968. END IF'
  969. END IF'
  970. UNTIL flag'
  971. % EVENT,0:FLUSHEVENTS'clear the event from the que
  972. WINDOW CLOSE ABS(wndRefNum)'close this feller
  973. END IF
  974. END IF
  975. END IF
  976. END IF
  977. "PG:Build Complete"
  978. FN pGcalcWndGlobals
  979. LONG IF gOutWindow
  980. CALL GETWTITLE(WINDOW(_wndPointer),gWindowTitle$)
  981. XELSE
  982. gWindowTitle$ = ""'clear related globals
  983. END IF
  984. END FN
  985. '_______________________________________________________________________________
  986. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ RUNTIME FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  987. '———————————————————————————————————————————————————————————————————————————————
  988. '_______________________________________________________________________________
  989. LOCAL FN pGmouse'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  990. '—————————————————————————————————————————————————————————————————————————————
  991. clickedObj = FN pGpointInObj
  992. LONG IF clickedObj
  993. FN pGgetObj(gWhichClass,clickedObj)
  994. LONG IF gObjKind = _buttonObj
  995. LONG IF gObjZType = 0
  996. gSubAction = _otherUserClick'tell user item was clicked
  997. gWhichObjElem = clickedObj
  998. GLOBALS GOSUB "PG:Any Other"
  999. END IF
  1000. END IF
  1001. END IF
  1002. END FN
  1003. '_______________________________________________________________________________
  1004. LOCAL FN pGcursor'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1005. '—————————————————————————————————————————————————————————————————————————————
  1006. LONG IF WINDOW(_outputWnd) = DIALOG(_cursEvent)'correct window?
  1007. SELECT gWhichButton'same as gWhichField
  1008. CASE   <0:'show IBeam cursor
  1009. TEHndl& = TEHANDLE(ABS(gWhichButton))'if T=B then it's a pict
  1010. LONG IF {[TEHndl&]+_TEViewRect} = {[TEHndl&]+_TEViewRect.bottom}
  1011. CURSOR _pictCursor'over a pict field
  1012. XELSE
  1013. CURSOR _iBeamCursor'over a text field
  1014. END IF
  1015. CASE   >0:CURSOR _buttonCursor'use hand cursor
  1016. CASE ELSE:CURSOR _arrowCursor
  1017. END SELECT
  1018. XELSE'not in active window
  1019. CURSOR _arrowCursor'back to arrow
  1020. END IF'
  1021. END FN
  1022. '_______________________________________________________________________________
  1023. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ MENU FUNCTIONS ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  1024. '———————————————————————————————————————————————————————————————————————————————
  1025. '_______________________________________________________________________________
  1026. LOCAL FN pGfindMenu(theTitle$)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1027. '—————————————————————————————————————————————————————————————————————————————
  1028. theMenu  = 0
  1029. mCount   = FN COUNTRESOURCES(_"MENU")
  1030. FOR thisMenu = 1 TO mCount
  1031. mHndl& = FN GETINDRESOURCE(_"MENU",thisMenu)
  1032. LONG IF mHndl&
  1033. LONG IF FN HOMERESFILE(mHndl&) = SYSTEM(_aplRes)
  1034. test$  = PSTR$([mHndl&] + _menuData)
  1035. LONG IF test$ = theTitle$
  1036. theMenu = {[mHndl&]}
  1037. thisMenu = mCount
  1038. END IF
  1039. END IF
  1040. END IF
  1041. NEXT
  1042. END FN = theMenu
  1043. '_______________________________________________________________________________
  1044. LOCAL FN pGfield(xLook,yLook)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1045. '—————————————————————————————————————————————————————————————————————————————
  1046. DIM srcT,srcL,srcB,srcR,destT;8
  1047. found = _false
  1048. srcT;8 = [TEHANDLE(gWhichField)]+_TEViewRect
  1049. objCount = FN pGcountObj(gWhichClass)
  1050. DO
  1051. CALL OFFSETRECT(srcT,xLook,yLook)
  1052. x = FN SECTRECT(srcT,#WINDOW(_wndPointer)+_portRect,destT)
  1053. LONG IF FN EQUALRECT(srcT,destT) = _false
  1054. found = _zTrue
  1055. XELSE
  1056. FOR loop = 1 TO objCount
  1057. FN pGgetObj(gWhichClass,loop)
  1058. LONG IF gObjKind = _styleObj
  1059. LONG IF gObjRef <> gWhichField
  1060. LONG IF ((gObjZType-1) AND &X1100)=0'not a static or gray field
  1061. LONG IF FN SECTRECT(srcT,gObjT,destT)
  1062. found = _zTrue
  1063. EDIT FIELD ABS(gObjRef)
  1064. END IF
  1065. END IF
  1066. END IF
  1067. END IF
  1068. NEXT
  1069. END IF
  1070. UNTIL found
  1071. END FN
  1072. '_______________________________________________________________________________
  1073. LOCAL FN pGtab(shiftDown)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1074. '—————————————————————————————————————————————————————————————————————————————
  1075. objCount = FN pGcountObj(gWhichClass)'object count for this wnd
  1076. LONG IF objCount'non zero?
  1077. dfltFld   = 0'default:nothing found
  1078. grabNext  = _false'don't record yet
  1079. LONG IF shiftDown'shift tab works in reverse
  1080. finish  = 1:start     = objCount'so run the loop backwards
  1081. theStep =-1'and step backwards
  1082. XELSE'otherwise
  1083. start   = 1:finish    = objCount'run loop forward thru list
  1084. theStep = 1'step is normal
  1085. END IF
  1086. FOR loop = start TO finish STEP theStep'loop thru all objs
  1087. FN pGgetObj(gWhichClass,loop)'get the next one
  1088. LONG IF gObjKind = _styleObj'a styled text field?
  1089.  
  1090. LONG IF ((gObjZType-1) AND &X1100)=0'not a static or gray field
  1091.  
  1092. LONG IF dfltFld = 0'default set yet?
  1093. dfltFld = gObjRef'no first item = wrap around
  1094. END IF
  1095.  
  1096. LONG IF grabNext'flag set to grab next?
  1097. dfltFld = gObjRef'yep-this is the field
  1098. loop    = finish'shortcut the loop
  1099. END IF
  1100.  
  1101. LONG IF gObjRef = gWhichField'this is the current field?
  1102. grabNext = _zTrue'yep-grab next one encountered
  1103. END IF
  1104.  
  1105. END IF'end of non-static field
  1106. END IF'end of styled text field
  1107. NEXT loop
  1108.  
  1109. LONG IF dfltFld'if we got one‚Ķ
  1110. EDIT FIELD dfltFld'    set it
  1111. LONG IF WINDOW(_selStart) = WINDOW(_EFTextLen)
  1112. LONG IF WINDOW(_EFnum) < 8000
  1113. SETSELECT 0,WINDOW(_EFTextLen)
  1114. END IF
  1115. END IF
  1116. END IF
  1117. END IF
  1118. END FN
  1119. '_______________________________________________________________________________
  1120. LOCAL FN pGgetItemName$(menuID,itemID)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1121. '—————————————————————————————————————————————————————————————————————————————
  1122. mHndl& = FN GETMHANDLE(menuID)
  1123. LONG IF mHndl&
  1124. CALL GETITEM(mHndl&,itemID,theName$)
  1125. XELSE
  1126. theName$ = ""
  1127. END IF
  1128. END FN = theName$
  1129. '_______________________________________________________________________________
  1130. LOCAL FN pGcheckName(theMenu,theName$)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1131. '—————————————————————————————————————————————————————————————————————————————
  1132. mHndl& = FN GETMHANDLE(theMenu)'handle to this menu
  1133. LONG IF mHndl&'valid handle?
  1134. itemCount = FN COUNTMITEMS(mHndl&)'number of items in menu
  1135. FOR loop = 1 TO itemCount'loop thru items
  1136. CALL GETITEM(mHndl&,loop,t$)'get name of item
  1137. LONG IF t$ = theName$'match?
  1138. DEF CHECKONEITEM(theMenu,loop)
  1139. loop = itemCount'skip the rest of the loop
  1140. END IF
  1141. NEXT
  1142. END IF
  1143. END FN
  1144. '_______________________________________________________________________________
  1145. CLEAR LOCAL'must clear pBlock
  1146. LOCAL FN pGopenFile'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1147. '—————————————————————————————————————————————————————————————————————————————
  1148. gFileName$ = FILES$(1,gOpenType$,,gFileVol)'standard files dialog
  1149. LONG IF PEEK(@gFileName$)'name <>""?
  1150. gSubAction = _mainOpen'set up message
  1151. pBlk&      = @paramBlk$'param Block to get file info
  1152. & pBlk& + _ioFDirIndex,0'clear to indicate op
  1153. & pBlk& + _ioNamePtr,@gFileName$'set up pointer to file name
  1154. % pBlk& + _ioVRefNum,gFileVol'set up vol number
  1155. OSErr      = FN GETFILEINFO(pBlk&)'get finder info on this file
  1156. gFileType& = [pBlk& + _ioBuffer]'get file type
  1157. fdFlags    = {pBlk& + _ioBuffer_fdflags}'get finder flags
  1158. gIsStationery = ((fdFlags AND 2048)<>0)'check stationery bit
  1159. GLOBALS GOSUB "PG:Any Main"'send it to program
  1160. END IF
  1161. END FN
  1162. '_______________________________________________________________________________
  1163. LOCAL FN pGsaveAs'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1164. '—————————————————————————————————————————————————————————————————————————————
  1165. LONG IF LEN(gSaveName$)'file name exists?
  1166. t$ = gSaveName$'use it
  1167. XELSE'otherwise
  1168. t$ = "Untitled Document"'use a default name
  1169. END IF
  1170. t$ = FILES$(0,"Save document as‚Ķ",t$,vol)'standard files
  1171. LONG IF LEN(t$)'SF wasn't canceled?
  1172. gSaveName$ = t$'file name into global
  1173. gSaveVol   = vol'vol ref into global
  1174. boolean    = _zTrue'success-set flag
  1175. XELSE'save was canceled
  1176. boolean    = _false'failure-clear flag
  1177. END IF
  1178. END FN = boolean
  1179. '_______________________________________________________________________________
  1180. LOCAL FN pGautoMenu(menuID,itemID)'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1181. '—————————————————————————————————————————————————————————————————————————————
  1182. mHndl& = FN GETMHANDLE(menuID)
  1183. LONG IF mHndl&
  1184. theTitle$ = PSTR$([mHndl&] + _menuData)
  1185. CALL GETITEM(mHndl&,itemID,theItem$)
  1186. LONG IF theTitle$ = STR#(_baseID - 2,1)'== FILE MENU ==
  1187. t$ = STR#(_baseID - 2,2)'special allowances for open
  1188. l = LEN(t$)'addn'l chars added by
  1189. LONG IF l
  1190. IF LEFT$(theItem$,l) = t$ THEN theItem$ = t$'       Boomerang
  1191. END IF
  1192. SELECT theItem$
  1193. CASE STR#(_baseID - 2,2)'"Open" item
  1194. FN pGopenFile
  1195. CASE STR#(_baseID - 2,4)'"Page Setup‚Ķ" item
  1196. DEF PAGE
  1197. CASE STR#(_baseID - 2,5)'"Close" item
  1198. LONG IF WINDOW(_activeWnd)
  1199. gDialogValue = WINDOW(_activeWnd)
  1200. GLOBALS GOSUB"PG:WCls"
  1201. END IF
  1202. CASE STR#(_baseID - 2,6)'"Quit" item
  1203. GLOBALS GOSUB"PG:Break"
  1204. CASE STR#(_baseID - 2,3)'"Save" item
  1205. boolean = _zTrue
  1206. LONG IF LEN(gSaveName$) = 0 OR gSaveVol = 0
  1207. boolean = FN pGsaveAs
  1208. END IF
  1209. LONG IF boolean
  1210. gSubAction = _mainSave
  1211. gDirty = _false
  1212. GLOBALS GOSUB"PG:Any Main"
  1213. END IF
  1214. CASE STR#(_baseID - 2,7)'"Save As‚Ķ" item
  1215. boolean = FN pGsaveAs
  1216. LONG IF boolean
  1217. gSubAction = _mainSave
  1218. gDirty = _false
  1219. GLOBALS GOSUB"PG:Any Main"
  1220. END IF
  1221. END SELECT
  1222. END IF
  1223. END IF
  1224. END FN
  1225. '_______________________________________________________________________________
  1226. LOCAL FN pGfixMenus'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1227. '—————————————————————————————————————————————————————————————————————————————
  1228. IF FN BUTTON THEN CURSOR _arrowCursor
  1229. t$ = STR#(_baseID - 2,1)'get name of File menu
  1230. LONG IF LEN(t$)
  1231. fileMenu = FN pGfindMenu(t$)
  1232. LONG IF fileMenu
  1233. mHndl& = FN GETMHANDLE(fileMenu)
  1234. LONG IF mHndl&
  1235. saveName$   = STR#(_baseID - 2,3)'name of Save item
  1236. saveAsName$ = STR#(_baseID - 2,7)'name of Save As‚Ķ item
  1237. printItem$  = STR#(_baseID - 2,8)'name of print item
  1238. itemCount   = FN COUNTMITEMS(mHndl&)
  1239. FOR loop = 1 TO itemCount
  1240. CALL GETITEM(mHndl&,loop,t$)
  1241. SELECT t$
  1242. CASE saveName$
  1243. MENU fileMenu,loop,ABS(gDirty<>0)'enable if dirty
  1244. IF WINDOW(_activeWnd) = 0 THEN MENU fileMenu,loop,0
  1245. CASE saveAsName$
  1246. MENU fileMenu,loop,ABS(LEN(gSaveName$)>0)'enable if file open
  1247. IF WINDOW(_activeWnd) = 0 THEN MENU fileMenu,loop,0
  1248. CASE printName$
  1249. MENU fileMenu,loop,ABS(WINDOW(_activeWnd)<>0)
  1250. END SELECT
  1251. NEXT
  1252. END IF
  1253. END IF
  1254. END IF
  1255. END FN
  1256. '_______________________________________________________________________________
  1257. LOCAL FN pGopenDoc'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1258. '—————————————————————————————————————————————————————————————————————————————
  1259. fileIndex = {[gFileList&]+2}
  1260. % [gFileList&]+2,fileIndex - 1
  1261. offSet = 4
  1262.  
  1263. LONG IF fileIndex > 1
  1264. FOR loop = 1 TO fileIndex - 1
  1265. offSet = offSet + 8
  1266. lgth = PEEK([gFileList&]+offSet) + 1
  1267. lgth = (lgth + 1) AND &FE
  1268. offSet=offSet+lgth
  1269. NEXT
  1270. END IF
  1271.  
  1272. gSubAction = {[gFileList&]} + 2'_mainOpen or _mainPrint
  1273. gFileVol   = {[gFileList&]+offSet}
  1274. gFileType& = [[gFileList&]+offSet+2]
  1275. gFileName$ = PSTR$([gFileList&]+offSet+8)
  1276.  
  1277. IF fileIndex = 1 THEN DEF DISPOSEH(gFileList&)
  1278.  
  1279. GLOBALS GOSUB "PG:Any Main"
  1280. END FN
  1281. '_______________________________________________________________________________
  1282. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ RUNTIME INIT ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  1283. '———————————————————————————————————————————————————————————————————————————————
  1284. '_______________________________________________________________________________
  1285. LOCAL FN pGinitRuntime'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1286. '—————————————————————————————————————————————————————————————————————————————
  1287. gEventPtr&   = EVENT'event rec never moves
  1288. IF SYSTEM(8) > 599 THEN & EVENT-8,1'WNE 60 times/sec(Sys.6.0 & up)
  1289. gResRef      = SYSTEM(4)'current resource reference
  1290. gScrnR       = SYSTEM(6)'screen width
  1291. gScrnB       = SYSTEM(7)'screen height
  1292. gScrnT       = {_mBarHeight}'allow for menu bar
  1293. gScreenDepth = SYSTEM(11)'max colors
  1294. CALL SETRECT(gBigT,-9999,-9999,9999,9999)'generic big rect
  1295.  
  1296. curRes = FN CURRESFILE'record curres file
  1297. CALL USERESFILE(gResRef)'switch to app's file
  1298. theCount = FN COUNT1RESOURCES(_"MENU")'how many menus?
  1299. WHILE theCount'more to go?
  1300. resHndl& = FN GET1INDRESOURCE(_"MENU",theCount)'get next menu
  1301. LONG IF resHndl&'valid handle?
  1302. menuID = {[resHndl&]}'get its ID
  1303. LONG IF menuID > 74 AND menuID < 100'74> Sub menus <100
  1304. MENU menuID,-2,1'insert it
  1305. END IF
  1306. END IF
  1307. DEC(theCount)'decrement index
  1308. WEND
  1309. CALL USERESFILE(curRes)
  1310.  
  1311. LONG IF SYSTEM(8) > 699'System 7.0 or later
  1312. LONG IF FN GESTALT(_gestaltAppleEventsAttr) AND SYSERROR = 0
  1313. OSErr = FN AEINSTALLEVENTHANDLER(_typeAppleEvent,_kAEOpenApplication,LINE"PG:AE Open App",0,_false)
  1314. OSErr = FN AEINSTALLEVENTHANDLER(_typeAppleEvent,_kAEOpenDocuments  ,LINE"PG:AE Open Doc",0,_false)
  1315. OSErr = FN AEINSTALLEVENTHANDLER(_typeAppleEvent,_kAEPrintDocuments ,LINE"PG:AE Print Doc",0,_false)
  1316. OSErr = FN AEINSTALLEVENTHANDLER(_typeAppleEvent,_kAEQuitApplication,LINE"PG:AE Quit App",0,_false)
  1317. END IF
  1318. END IF
  1319.  
  1320. LONG IF [_appParmHandle]
  1321. LONG IF {[[_appParmHandle]]+2}
  1322. LONG IF SYSTEM(_aplFlag)
  1323. gFileList& = FN HANDTOHAND([_appParmHandle])
  1324. END IF
  1325. END IF
  1326. END IF
  1327.  
  1328. DIM pGwT,pGwL,pGwB,pGwR,pGwKind,pGwAttrs,pGwMinX,pGwMinY
  1329. DIM pGwMaxX,pGwMaxY,pGZmT,pGZmL,pGZmB,pGZmR
  1330. DIM pGwHpg,pGwHMax,pGwVpg,pGwVMax,pGwRefCon&
  1331.  
  1332. theCount = FN COUNTRESOURCES(_"pG3w")'look for splash windows
  1333. FOR loop = 1 TO theCount
  1334. resHndl& = FN GETINDRESOURCE(_"pG3w",loop)
  1335. LONG IF resHndl&
  1336. BLOCKMOVE [resHndl&],@pGwT,FN GETHANDLESIZE(resHndl&)
  1337. LONG IF pGwVMax = 0
  1338. LONG IF pGwAttrs AND 128
  1339. CALL GETRESINFO(resHndl&,ID,tp&,t$)
  1340. FN pGbuild(ID)
  1341. loop = theCount
  1342. END IF
  1343. END IF
  1344. END IF
  1345. NEXT
  1346.  
  1347. GLBLask&       = @FN pGask$          :GLBLautoMenu&  = @FN pGautoMenu
  1348. GLBLBlkNWhite& = @FN pGblackAndWhite :GLBLbtnAction& = @FN pGbtnAction
  1349. GLBLbuild&     = @FN pGbuild         :GLBLcheckName& = @FN pGcheckName
  1350. GLBLclose&     = @FN pGclose         :GLBLcloseAll&  = @FN pGcloseAll
  1351. GLBLcntrRes&   = @FN pGcntrRes       :GLBLcountObj&  = @FN pGcountObj
  1352. GLBLcursor&    = @FN pGcursor        :GLBLdrwCtrls&  = @FN pGdrawControls
  1353. GLBLfield&     = @FN pGfield         :GLBLfindMenu&  = @FN pGfindMenu
  1354. GLBLfixEditor& = @FN pGfixEditor     :GLBLfixMenus&  = @FN pGfixMenus
  1355. GLBLframeBtn&  = @FN pGframeBtn      :GLBLgetGroup&  = @FN pGgetGroup
  1356. GLBLgetIName&  = @FN pGgetItemName$  :GLBLgetObj&    = @FN pGgetObj
  1357. GLBLgetRef&    = @FN pGgetRef        :GLBLgetText&   = @FN pGgetText$
  1358. GLBLgetWnd&    = @FN pGgetWnd$       :GLBLgetWTitle& = @FN pGgetWTitle
  1359. GLBLinitRntm&  = @FN pGinitRuntime   :GLBLinsetWnd&  = @FN pGinsetWnd
  1360. GLBLmouse&     = @FN pGmouse         :GLBLopenDoc&   = @FN pGopenDoc
  1361. GLBLopenFile&  = @FN pGopenFile      :GLBLptInObj&   = @FN pGpointInObj
  1362. GLBLputObj&    = @FN pGputObj        :GLBLputWnd&    = @FN pGputWnd
  1363. GLBLrepRes&    = @FN pGreplaceRes    :GLBLrepXRes&   = @FN pGreplaceXRes
  1364. GLBLsaveAs&    = @FN pGsaveAs        :GLBLsetGroup&  = @FN pGsetGroup
  1365. GLBLsetGrow&   = @FN pGsetGrow       :GLBLsetZoom&   = @FN pGsetZoom
  1366. GLBLshowErr&   = @FN pGshowErr       :GLBLtab&       = @FN pGtab
  1367. GLBLupdate&    = @FN pGupdate        :GLBLuseObjClr& = @FN pGuseObjColor
  1368. GLBLpntDpth&   = @FN pGdepthOfPoint
  1369.  
  1370. END FN
  1371. '_______________________________________________________________________________
  1372. CLEAR LOCAL'must clear pBlk & noName$
  1373. LOCAL FN pGAEDocList'‚Ä∫ԨłÄ∫ 01/15/92 ‚Ä∫ԨłÄ∫
  1374. '—————————————————————————————————————————————————————————————————————————————
  1375. DIM AEDesc&;0,descriptorType&,dataHandle&
  1376. DIM fsSpec;0,fsVRefNum,fsParID&,63 fsName$
  1377. maxSize& = @maxSize& - @fsSpec
  1378.  
  1379. LONG IF FN AEGETPARAMDESC(gEventPtr&,_keyDirectObject,_typeAEList,AEDesc&)= 0
  1380. LONG IF FN AECOUNTITEMS(AEDesc&,theCount&) = 0
  1381. FOR loop = 1 TO theCount&
  1382. LONG IF FN AEGETNTHPTR(AEDesc&,loop,_typeFSS,keyWord&,rtnType&,@fsSpec,maxSize&,actualSize&) = 0
  1383. gFileName$ = fsName$'record name from FS rec
  1384. pBlk&      = @paramBlk$'chg WrkDirID to vRefNum
  1385. % pBlk& + _ioVRefNum ,fsVRefNum'volume ref num
  1386. & pBlk& + _ioWDDirID ,fsParID&'set par ID in pblock
  1387. OSErr      = FN OPENWD(pBlk&)'open this path
  1388. gFileVol   = {pBlk& + _ioVRefNum}'get volRef num
  1389. & pBlk& + _ioFDirIndex,0'clear dir index to indicate op
  1390. & pBlk& + _ioNamePtr,@fsName$'set up pointer to file name
  1391. OSErr      = FN GETFILEINFO(pBlk&)'get finder info on this file
  1392. gFileType& = [pBlk& + _ioBuffer]'get file type
  1393. fdFlags    = {pBlk& + _ioBuffer_fdflags}'get finder flags
  1394. gIsStationery = ((fdFlags AND 2048)<>0)'check stationery bit
  1395. GLOBALS GOSUB "PG:Any Main"
  1396. END IF
  1397. DEF BLOCKFILL(pBlk&,250,0)' ‚àë‚àë 8/13/93 ‚àë‚àë
  1398. NEXT
  1399. END IF
  1400. OSErr = FN AEDISPOSEDESC(AEDesc&)
  1401. END IF
  1402. END FN
  1403. '_______________________________________________________________________________
  1404. "PG:AE Open App"'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1405. '———————————————————————————————————————————————————————————————————————————————
  1406. ENTERPROC(gEventPtr&,gEventPtr&,gWhichRefCon&)
  1407. :'do nothing
  1408. gMessage1 = 0
  1409. EXITPROC = gMessage1
  1410. RETURN
  1411. '_______________________________________________________________________________
  1412. "PG:AE Quit App"'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1413. '———————————————————————————————————————————————————————————————————————————————
  1414. ENTERPROC(gEventPtr&,gEventPtr&,gWhichRefCon&)
  1415. GLOBALS GOSUB "PG:Break"
  1416. gMessage1 = 0
  1417. EXITPROC = gMessage1
  1418. RETURN
  1419. '_______________________________________________________________________________
  1420. "PG:AE Print Doc"'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1421. '———————————————————————————————————————————————————————————————————————————————
  1422. ENTERPROC(gEventPtr&,gEventPtr&,gWhichRefCon&)
  1423. gSubAction = _mainPrint
  1424. FN pGAEDocList
  1425. gMessage1 = 0
  1426. EXITPROC = gMessage1
  1427. RETURN
  1428. '_______________________________________________________________________________
  1429. "PG:AE Open Doc"'‚àë‚àë≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì≈ì‚àë‚àë
  1430. '———————————————————————————————————————————————————————————————————————————————
  1431. ENTERPROC(gEventPtr&,gEventPtr&,gWhichRefCon&)
  1432. gSubAction = _mainOpen
  1433. FN pGAEDocList
  1434. gMessage1 = 0
  1435. EXITPROC = gMessage1
  1436. RETURN
  1437. '_______________________________________________________________________________
  1438. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ RUNTIME PACKAGE ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  1439. '———————————————————————————————————————————————————————————————————————————————
  1440. "PG:Start"
  1441. FN pGinitRuntime'handle my startup
  1442. ON BREAK      GOSUB "PG:Chk Break"'go here for command-period
  1443. ON DIALOG     GOSUB "PG:Dialog"'use this routine for dialog
  1444. ON EDIT       GOSUB "PG:TEKey"'filter keys for edit flds
  1445. ON EVENT      GOSUB "PG:Event"'pre-event filter
  1446. ON MENU       GOSUB "PG:Menu"'menu handlers
  1447. ON MOUSE      GOSUB "PG:Mouse"'mouse handler
  1448. ON TIMER(-10) GOSUB "PG:Timer"'ZTimer (30 ticks=1/2 second)
  1449. ON STOP       GOSUB "PG:Stop"
  1450. '-------------------------------------------------------------------------------
  1451. gSubAction =_mainStart'let user init
  1452. GOSUB "PG:Any Main"
  1453. '-------------------------------------------------------------------------------
  1454. DO
  1455. MENU ON  : DIALOG ON  : BREAK ON  : MOUSE ON  : TIMER ON  : EVENT ON
  1456. MENU OFF : DIALOG OFF : BREAK OFF : MOUSE OFF : TIMER OFF : EVENT OFF
  1457. IF gKissOfDeath THEN GOSUB"PG:Break"
  1458. UNTIL 0
  1459. '-------------------------------------------------------------------------------
  1460. "PG:Menu"
  1461. '-------------------------------------------------------------------------------
  1462. gAction    = _MenuAction'action constant
  1463. gWhichMenu = MENU(_menuID)'selected menu
  1464. gWhichItem = MENU(_itemID)'selected item
  1465. gItemName$ = FN pGgetItemName$(gWhichMenu,gWhichItem)'get name of this item
  1466. GOSUB "PG:Send Event"'send event to user
  1467. MENU'unhilite the menu
  1468. IF gAction THEN FN pGautoMenu(gWhichMenu,gWhichItem)
  1469. RETURN'done
  1470. '-------------------------------------------------------------------------------
  1471. "PG:Dialog"
  1472. '-------------------------------------------------------------------------------
  1473. gWhichDialog = DIALOG(0)'dialog action
  1474. gDialogValue = DIALOG(gWhichDialog)'dialog reference
  1475. ON gWhichDialog      GOTO "PG:Btn" ,"PG:EAct","PG:WClk","PG:WCls" ,"PG:WUpd"
  1476. ON gWhichDialog -  5 GOTO "PG:ERet","PG:ETab","PG:NOP" ,"PG:NOP"  ,"PG:EStb"
  1477. ON gWhichDialog - 10 GOTO "PG:EClr","PG:ELft","PG:ERt" ,"PG:EUp"  ,"PG:EDn"
  1478. ON gWhichDialog - 15 GOTO "PG:Key" ,"PG:Dsk" ,"PG:WAct","PG:MFevt","PG:Gcrs"
  1479. ON gWhichDialog - 20 GOTO "PG:Crsr","PG:Abt" ,"PG:Usr"
  1480. RETURN
  1481. '===============================================================================
  1482. "PG:Btn"'(1) Button clicked
  1483. gAction      = _buttonAction'action constant
  1484. gWhichButton = gDialogValue'clicked button
  1485. gWhichClass  = WINDOW(_outputWClass)
  1486. FN pGbtnAction(gWhichButton)
  1487. gWhichObjElem= FN pGgetRef(gWhichClass,gWhichButton)'get btn's obj record
  1488. gButtonValue = BUTTON(gWhichButton)'current btn value
  1489. gControlHndl&= BUTTON&(gWhichButton)'get control's handle
  1490. LONG IF (FN GETCREFCON(gControlHndl&)>>29) = 4'ZBasic scroll bar?
  1491. gControlTitle$ = STR#(_baseID-5,4)'send "Scroll Button" as title
  1492. XELSE'not a scroll bar?
  1493. CALL GETCTITLE(gControlHndl&,gControlTitle$)'send control's title
  1494. END IF
  1495. GOTO "PG:Send Event"
  1496. RETURN
  1497. '===============================================================================
  1498. "PG:WClk"'(5) Inactive Window Clicked
  1499. gSubAction   = _windowClicked'sub action:click in inactive
  1500. gWhichWindow = gDialogValue'window clicked
  1501. GOSUB "PG:Any Window"'send wnd msg(sets action _con)
  1502. LONG IF gAction'not handled by user?
  1503. IF gWhichWindow THEN WINDOW gWhichWindow'I'll do the switch
  1504. END IF
  1505. RETURN
  1506. '-------------------------------------------------------------------------------
  1507. "PG:WCls"'(4) Click in close box
  1508. gSubAction   = _windowClose'subaction constant
  1509. gWhichWindow = gDialogValue
  1510. GOSUB "PG:Any Window"'send wnd msg(sets action _con)
  1511. LONG IF gAction'not handled by user?
  1512. FN pGcloseWindow(gWhichWindow)'I'll close it
  1513. END IF
  1514. RETURN
  1515. '-------------------------------------------------------------------------------
  1516. "PG:WAct"'(18) activate/deactivate
  1517. gWhichWindow = ABS(gDialogValue)
  1518. LONG IF gDialogValue > 0
  1519. gSubAction =_windowActivate' positive = activate
  1520. XELSE' negative = deactivate
  1521. gSubAction =_windowDeactivate
  1522. END IF
  1523. GOTO "PG:Any Window"'send wnd msg(sets action _con)
  1524. RETURN
  1525. '-------------------------------------------------------------------------------
  1526. "PG:WUpd"'(5) update
  1527. gWhichWindow = gDialogValue
  1528. gSubAction   = _windowUpdate
  1529. gOutputWas   = WINDOW(_outputWnd)
  1530. WINDOW OUTPUT gWhichWindow
  1531. GOSUB "PG:Any Window"
  1532. IF gAction THEN FN pGupdate
  1533. IF gOutputWas THEN WINDOW OUTPUT gOutputWas
  1534. RETURN
  1535. '-------------------------------------------------------------------------------
  1536. "PG:NOP"'No Operation
  1537. RETURN
  1538. '===============================================================================
  1539. "PG:EAct"'(2) Edit/Pict field Clicked
  1540. gSubAction = _fieldActivate
  1541. gFieldWas  = WINDOW(_lastEFnum)
  1542. GOTO "PG:Any Field"
  1543. RETURN
  1544. '-------------------------------------------------------------------------------
  1545. "PG:ERet"'(6) Return key in field
  1546. gSubAction = _fieldReturn
  1547. GOTO "PG:Any Field"
  1548. RETURN
  1549. '-------------------------------------------------------------------------------
  1550. "PG:ETab"'(7) Tab Key pressed
  1551. gSubAction = _fieldTab
  1552. GOSUB "PG:Any Field"
  1553. IF gAction THEN FN pGtab(_false)
  1554. RETURN
  1555. '-------------------------------------------------------------------------------
  1556. "PG:EStb"'(10) shift tab pressed
  1557. gSubAction = _fieldShiftTab
  1558. GOSUB "PG:Any Field"
  1559. IF gAction THEN FN pGtab(_zTrue)
  1560. RETURN
  1561. '-------------------------------------------------------------------------------
  1562. "PG:EClr"'(11) clear key pressed
  1563. gSubAction = _fieldClear
  1564. GOSUB "PG:Any Field"
  1565. IF gAction THEN EDIT FIELD gObjRef,""
  1566. RETURN
  1567. '-------------------------------------------------------------------------------
  1568. "PG:ELft"'(12) left arrow pressed
  1569. gSubAction = _fieldLeft
  1570. GOSUB "PG:Any Field"
  1571. IF gAction THEN FN pGfield(-10,0)
  1572. RETURN
  1573. '-------------------------------------------------------------------------------
  1574. "PG:ERt"'(13) right arrow pressed
  1575. gSubAction = _fieldRight
  1576. GOSUB "PG:Any Field"
  1577. IF gAction THEN FN pGfield(10,0)
  1578. RETURN
  1579. '-------------------------------------------------------------------------------
  1580. "PG:EUp"'(14) up arrow pressed
  1581. gSubAction = _fieldUp
  1582. GOSUB "PG:Any Field"
  1583. IF gAction THEN FN pGfield(0,-10)
  1584. RETURN
  1585. '-------------------------------------------------------------------------------
  1586. "PG:EDn"'(15) down arrow pressed
  1587. gSubAction = _fieldDown
  1588. GOSUB "PG:Any Field"
  1589. IF gAction THEN FN pGfield(0,10)
  1590. RETURN
  1591. '-------------------------------------------------------------------------------
  1592. "PG:Any Field"'branch sets action constant
  1593. gAction       = _fieldAction
  1594. gWhichField   = gDialogValue
  1595. gWhichObjElem = FN pGgetRef(WINDOW(_outputWClass),gWhichField)'get field's obj record
  1596. FN pGgetObj(WINDOW(_outputWClass),gWhichObjElem)
  1597. GOTO "PG:Send Event"
  1598. RETURN
  1599. '===============================================================================
  1600. "PG:Key"'(16) Key Presed Not in Field
  1601. gKey$ = CHR$(gDialogValue)
  1602. gSubAction = _otherKeyPressed
  1603. GOTO "PG:Any Other"
  1604. RETURN
  1605. '-------------------------------------------------------------------------------
  1606. "PG:Dsk"'(17) Disk Inserted
  1607. gSubAction = _otherDisk
  1608. GOSUB "PG:Any Other"
  1609. IF gAction THEN FN pGopenFile
  1610. RETURN
  1611. '-------------------------------------------------------------------------------
  1612. "PG:MFevt"'(19) MultiFinder Event
  1613. SELECT gDialogValue
  1614. CASE _MFResume'resume
  1615. gSubAction = _otherSwitch
  1616. gInBackground = _false
  1617. FLUSHEVENTS
  1618. CASE _MFSuspend'suspend
  1619. gSubAction = _otherSwitch
  1620. gInBackground = _zTrue
  1621. CASE _MFClipboard'convert scrap
  1622. gSubAction = _otherScrap
  1623. gInBackground = _false
  1624. CASE _MFMouse'mouse moved from MF region
  1625. gSubAction = _otherCursor
  1626. END SELECT
  1627. GOTO "PG:Any Other"
  1628. RETURN
  1629. '-------------------------------------------------------------------------------
  1630. "PG:Gcrs"'(20) New Global Mouse Position
  1631. gSubAction = _otherCursor
  1632. GOSUB "PG:Any Other"'send to user
  1633. LONG IF gAction'not handled?
  1634. CURSOR _arrowCursor'back to arrow
  1635. END IF
  1636. RETURN
  1637. '-------------------------------------------------------------------------------
  1638. "PG:Crsr"'(21) New Cursor Pos in Window
  1639. gWhichButton = gDialogValue
  1640. gSubAction = _otherCursor
  1641. GOSUB "PG:Any Other"'send to user
  1642. LONG IF gAction'not handled?
  1643. FN pGcursor
  1644. END IF
  1645. RETURN
  1646. '-------------------------------------------------------------------------------
  1647. "PG:Abt"'(22) About to ???
  1648. SELECT CASE gDialogValue
  1649. CASE _premenuclick'mouse in bar or cmnd key
  1650. FN pGfixMenus
  1651. gSubAction = _otherBeforeMenu
  1652. GOSUB "PG:Any Other"'send to user
  1653. CASE _preWndGrow'mouse in grow box
  1654. gSubAction   = _WindowWillGrow
  1655. gWhichWindow = WINDOW(_activeWnd)
  1656. GOSUB "PG:Any Window"
  1657. LONG IF gAction
  1658. FN pGsetGrow
  1659. END IF
  1660. CASE _wndMoved'already did a drag
  1661. gSubAction   = _windowMoved
  1662. gWhichWindow = WINDOW(_activeWnd)
  1663. GOSUB "PG:Any Window"
  1664. CASE _wndSized'after grow
  1665. gWhichWindow = WINDOW(_activeWnd)
  1666. gSubAction   = _windowSized
  1667. GOSUB "PG:Any Window"
  1668. LONG IF gAction
  1669. FN pGfixEditor
  1670. END IF
  1671. CASE 5'field about to change
  1672. gSubAction = _fieldChanging
  1673. gDialogValue = WINDOW(_EFnum)
  1674. GOSUB "PG:Any Field"
  1675. CASE 6'field clicked
  1676. gSubAction = _fieldClicked
  1677. gDialogValue = WINDOW(_EFnum)
  1678. GOSUB "PG:Any Field"
  1679. CASE _preWndZoomIn'about to zoom in
  1680. gSubAction   = _windowWillZoomIn
  1681. gWhichWindow = WINDOW(_activeWnd)
  1682. GOSUB "PG:Any Window"
  1683. CASE _preWndZoomOut'about to zoom out
  1684. gSubAction   = _windowWillZoomOut
  1685. gWhichWindow = WINDOW(_activeWnd)
  1686. GOSUB "PG:Any Window"
  1687. IF gAction THEN FN pGsetZoom
  1688. CASE _wndDocWillMove'background window will move
  1689. gSubAction   = _windowDocWillMove
  1690. gWhichWindow = WINDOW(_outputWnd)
  1691. GOSUB "PG:Any Window"
  1692. END SELECT
  1693. RETURN
  1694. '-------------------------------------------------------------------------------
  1695. "PG:Usr"'(23) User Posted Event
  1696. LONG IF gDialogValue < 0
  1697. FN pGshowErr(EVENT%)'field or other error
  1698. RETURN
  1699. XELSE
  1700. gSubAction = _otherUser
  1701. GOTO "PG:Any Other"
  1702. END IF
  1703. '===============================================================================
  1704. "PG:Chk Break" IF _ignoreCmndPeriod THEN RETURN'command period pressed
  1705. "PG:Break"'called to exit
  1706. gSubAction = _mainShutDown
  1707. gKissOfDeath = _zTrue
  1708. GOSUB "PG:Any Main"'ask user to shutdown
  1709. LONG IF gAction'user didn't abort close
  1710. LONG IF FN pGcloseAll'could we close all windows
  1711. END'we're outta here
  1712. END IF
  1713. END IF
  1714. gKissOfDeath = _false
  1715. RETURN
  1716. '===============================================================================
  1717. "PG:Stop"
  1718. DEF DISPOSEH(gFileList&)
  1719. RETURN
  1720. '===============================================================================
  1721. "PG:Mouse"
  1722. gAction      = _mouseAction
  1723. gClickStatus = MOUSE(0)
  1724. gMouseX      = MOUSE(1)
  1725. gMouseY      = MOUSE(2)
  1726. gModifiers   = EVENT%
  1727. gWhen&       = EVENT&
  1728. gWhereY;4    = @gMouseY
  1729. CALL LOCALTOGLOBAL(gWhereY)
  1730. GOSUB "PG:Send Event"
  1731. IF gAction THEN FN pGmouse
  1732. RETURN
  1733. '===============================================================================
  1734. "PG:Timer"
  1735. gSubAction = _mainTimer
  1736. GOTO "PG:Any Main"
  1737. RETURN
  1738. '===============================================================================
  1739. "PG:TEKey"
  1740. gKey$        = TEKEY$
  1741. gSubAction   = _fieldKeyPressed
  1742. gDialogValue = WINDOW(_EFnum)
  1743. gWhichField  = gDialogValue
  1744. GOSUB "PG:Any Field"
  1745. LONG IF gAction
  1746. LONG IF gKey$ = CHR$(127)
  1747. gKey$  = CHR$(29) + CHR$(8)
  1748. END IF
  1749. TEKEY$ = gKey$
  1750. END IF
  1751. RETURN
  1752. '===============================================================================
  1753. "PG:Event"
  1754. gAction = _otherAction
  1755. gWhat;_evtBlkSize = EVENT
  1756. LONG IF {EVENT}
  1757. gSubAction = _otherFilterEvent
  1758. XELSE
  1759. LONG IF gFileList&
  1760. FN pGopenDoc:RETURN
  1761. XELSE
  1762. gSubAction = _otherNullEvent
  1763. END IF
  1764. END IF
  1765. GOSUB "PG:Main Program"
  1766. LONG IF {EVENT}=_updatEvt
  1767. LONG IF gAction > 0
  1768. gWhichClass = WINDOW(_outputWClass)
  1769. FN pGblackAndWhite
  1770. END IF
  1771. END IF
  1772. RETURN
  1773. '_______________________________________________________________________________
  1774. '‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ  MAIN  ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ‚Ǩ
  1775. '———————————————————————————————————————————————————————————————————————————————
  1776. "PG:Any Window"
  1777. gAction = _windowAction
  1778. FN pGgetWTitle(gWhichWindow)'get title of this window
  1779. GOTO "PG:Send Event"
  1780. RETURN
  1781. '-------------------------------------------------------------------------------
  1782. "PG:Any Main"
  1783. gAction = _mainAction
  1784. GOTO "PG:Send Event"
  1785. RETURN
  1786. '-------------------------------------------------------------------------------
  1787. "PG:Any Other"
  1788. gAction = _otherAction
  1789. '-------------------------------------------------------------------------------
  1790. "PG:Send Event"
  1791. FN pGcalcWndGlobals
  1792. '-------------------------------------------------------------------------------
  1793. '*******************************************************************************
  1794. "PG:Main Program"
  1795. '*******************************************************************************
  1796.  
  1797.